<?php
//============================================================+
// File name   : example_001.php
// Begin       : 2008-03-04
// Last Update : 2010-08-14
//
// Description : Example 001 for TCPDF class
//               Default Header and Footer
//
// Author: Nicola Asuni
//
// (c) Copyright:
//               Nicola Asuni
//               Tecnick.com s.r.l.
//               Via Della Pace, 11
//               09044 Quartucciu (CA)
//               ITALY
//               www.tecnick.com
//               info@tecnick.com
//============================================================+

/**
 * Creates an example PDF TEST document using TCPDF
 * @package com.tecnick.tcpdf
 * @abstract TCPDF - Example: Default Header and Footer
 * @author Nicola Asuni
 * @since 2008-03-04
 */

require_once('../../Funciones/tcpdf/config/lang/eng.php');
require_once('../../Funciones/tcpdf/tcpdf.php');
include ("../../Funciones/Conexion.php");

// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Universidad de El Salvador');
$pdf->SetTitle('SIRAC');
$pdf->SetSubject('Sistema de Registro y Administracion de Asociones Coopereativas');
$pdf->SetKeywords('SIRAC,PDF');

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, PDF_HEADER_STRING2);

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set default font subsetting mode
$pdf->setFontSubsetting(true);

// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 10, '', true);

// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();

// Set some content to print
$grupo='dgp0001';
$link=Conexion();
$Consulta=pg_query($link,"SELECT * FROM tblusuario");
if(!$Consulta){
echo'<div class="error_ mensajes"><strong>Error</strong><br/>Error al cargar Los datos<br/>Si el Problema continua reportelo al administrador del Sistema.</div>';
echo pg_last_error();
exit();
}
//$Datos=pg_fetch_row($Consulta);
$html ='
<div style="margin:2px;"><br/><br/>
<table style="width:900px" border="1">	
<tr style=" background-color:#A4D4FA;">	
<td width="30px"><strong>N&ordm;</strong></td>
<td width="180px"><strong>Grupo Precooperativo</strong></td>
<td width="150px"><strong>Abreviatura</strong></td>
<td width="290px">Direccion</td>
</tr>';
$i=1;
while($Datos=pg_fetch_row($Consulta)){	  

$html.='	  	   
<tr>
<td width="30px">'.$i.'</td>
<td width="180px">'.$Datos[0].'</td>
<td width="150px">'.$Datos[1].'</td>
<td width="290px">'.$_GET['hola'].'</td>
</tr>';
$i++;
}
$html.='	    
</table>
</div>
';

// Print text using writeHTMLCell()
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);


// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');

//============================================================+
// END OF FILE
//============================================================+

?>